package io.renren.controller;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;
import io.renren.modules.res.entity.DirectiveEntity;
import io.renren.modules.res.service.DirectiveService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * 
 *
 * @author hyw
 * @email 1937095768@qq.com
 * @date 2019-03-18 21:23:12
 */
@RestController
@RequestMapping("/api/directive")
@Api(tags="测试接口")
public class DirectiveController {
    @Autowired
    private DirectiveService directiveService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = directiveService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Integer id){
        DirectiveEntity directive = directiveService.getById(id);
        return R.ok().put("directive", directive);
    }
}
